import request from '@/utils/request'

export default {
  //获取标准数据
  getMateriallist(info){
    return request({
      url:'/material/list',
      method:'post',
      data:info
    })
  },
  //根据id获取标准数据
  getMaterialById(id){
    return request({
      url:'/material/' + id,
      method:'get'
    })
  },

  //保存数据
  saveList(material){
    if (material.id == null && material.id === undefined){
      return this.addStandard(material);
    }else{
      return this.updateStandard(material);
    }
  },

  //新增标准
  addStandard(material) {
    return request({
      url: '/material',
      method: 'post',
      data:material
    })
  },

  //修改标准
  updateStandard(material) {
    return request({
      url: '/material',
      method: 'put',
      data:material
    })
  },
  //删除标准
  delStandardById(id){
    return request({
      url:'/material/' + id,
      method:'delete',
    })
  }
}





